package review.chapter04;

/**
 * Enjoy programming!!!
 * Time: 2021/12/22 -  16:35
 */
public class B extends A{
    @Override
    public float getNum(){
        System.out.println(" 子类getNum被调用 用的重写");
        return 8.0f;
    }
//    @Override 会报错
    public void getNum(double d){
        System.out.println("子类getNum被调用，用的重载");
    }
    public static void main(String[] args){
       B b = new B();
        System.out.println(b.getNum());
    }
}

class A{
    public float getNum(){
        System.out.println("父类getNum被调用");
        return 3.0f;
    }
}